package cn.bbdx.qsh.baking.controller;

import cn.bbdx.qsh.baking.response.JsonResult;
import cn.bbdx.qsh.baking.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/v1/banners")
public class BannerController {
    @Autowired
    BannerService bannerService;

    @GetMapping("")
    public JsonResult select() {
        return JsonResult.ok(bannerService.select());
    }

    @GetMapping("admin")
    public JsonResult selectForAdmin() {
        return JsonResult.ok(bannerService.selectForAdmin());
    }

    @PostMapping("{id}/delete")
    public JsonResult deleteById(@PathVariable Long id) {
        bannerService.deleteById(id);
        return JsonResult.ok();
    }
}
